const CracoLessPlugin = require("craco-less");
module.exports = {
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            javascriptEnabled: true,
          },
        },
      },
    },
  ],
  webpack: (config) => {
    config.output.library = "reactApp";
    config.output.libraryTarget = "umd";
    // webpack 5 需要把 jsonpFunction 替换成 chunkLoadingGlobal
    config.output.chunkLoadingGlobal = "webpackJsonp_reactApp";
    config.output.globalObject = "window";
    return config;
  },
  devServer: {
    // 移除 watchContentBase
    static: {
      directory: './public', // 静态资源目录
      watch: true // 替代 watchContentBase
    }
  }
};
